import os,sys
from fastapi import APIRouter,UploadFile

fileRoute=APIRouter()

UPLOAD_DIR = "../static/uploads"
os.makedirs(UPLOAD_DIR, exist_ok=True)

@fileRoute.post("/file")
async def upload_multiple_files(files:list[UploadFile]):
    print(sys.version_info)

    for file in files:
        file_path = os.path.join(UPLOAD_DIR, file.filename)
        with open(file_path, "wb") as f:
            contents = await file.read()
            f.write(contents)
    return "Success"